package com.zyx.nettypro.netty.handler;

import io.netty.buffer.ByteBuf;
import io.netty.channel.ChannelHandlerContext;
import io.netty.handler.codec.MessageToByteEncoder;

/**
 * @author Yaxi.Zhang
 * @since 2021/9/23 17:31
 */
public class MyLongToByteEncoder extends MessageToByteEncoder<Long> {
    @Override
    protected void encode(ChannelHandlerContext ctx, Long msg, ByteBuf out) throws Exception {
        System.out.println("MyLongToByteEncoder encode 被调用...");
        System.out.println("msg = " + msg);
        System.out.println("====================");
        out.writeLong(msg);
    }
}
